 /**
 * Description: 盘点明细报表
 * @author:Hunter
 * @since:1.0.0
 *
 * Modification History:
 * Date         Author      Version     Description
 * ------------------------------------------------------------------
 * 2018-04-08   Hunter       1.0.0     Initial
 */
package com.metro.paperless.report.service.impl;

import com.metro.core.dao.IMapper;
import com.metro.core.service.BaseServiceSupport;
import com.metro.core.service.ServiceException;
import com.metro.core.vo.ResultCode;
import com.metro.core.vo.inf.IResult;

import java.util.Date;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.metro.paperless.biz.mapper.IBizMaterialsManageMapper;
import com.metro.paperless.biz.service.inf.IBizMaterialsManageService;
import com.metro.paperless.report.beans.vo.ReportCheck;
import com.metro.paperless.report.beans.vo.ReportOutAndIn;
import com.metro.paperless.report.mapper.IReportCheckMapper;
import com.metro.paperless.report.mapper.IReportOutAndInMapper;
import com.metro.paperless.report.service.inf.IReportCheckService;
import com.metro.paperless.report.service.inf.IReportOutAndInService;
import com.metro.paperless.biz.beans.vo.BizMaterialsManage;

 /**
 * 盘点明细报表<br>
 *
 * @author:Hunter
 * @since:1.0.0
 * @version [1.0.0, 2018-04-08]
 */
@Service("reportCheckService")
public class ReportCheckService extends BaseServiceSupport<ReportCheck> implements IReportCheckService{
    //出入库明细报表Mapper
    @Autowired
    private IReportCheckMapper reportCheckMapper;

    @Override
    public IMapper getMapper() {
        return reportCheckMapper;
    }

    @Override
    public IResult save(ReportCheck entity) {
        try {
        	reportCheckMapper.save(entity);
            return ResultCode.SUCCESS;
        } catch (Exception e) {
            log.error("新增物资管理失败", e);
            throw new ServiceException(ResultCode.ERROR);
        }
    }

    @Override
    public IResult update(ReportCheck entity) {
        try {
        	reportCheckMapper.updateNotEmpty(entity);
            return ResultCode.SUCCESS;
        } catch (Exception e) {
            log.error("修改物资管理失败", e);
            throw new ServiceException(ResultCode.ERROR);
        }
    }

    @Override
    public IResult delete(Long id) {
        try {
        	reportCheckMapper.delete(id);
            return ResultCode.SUCCESS;
        } catch (Exception e) {
            log.error("删除失败", e);
            throw new ServiceException(ResultCode.ERROR);
        }
    }

    @Override
    public IResult deleteByIds(String ids) {
        try {
        	reportCheckMapper.deleteByIds(ids);
            return ResultCode.SUCCESS;
        } catch (Exception e) {
            log.error("删除失败", e);
            throw new ServiceException(ResultCode.ERROR);
        }
    }
    
}